﻿Imports System.IO
Imports System.Net

Public Class Stock
    Public stoc As String = Nothing
    Public Function copyData2Clipboard() As Boolean
        If Copy2Clipboard() = True Then
            Return True
        End If
        Return False
    End Function
    Public Function getStockImage() As Image
        Dim wc As New WebClient
        Dim imagez() As Byte = Nothing
        If Not stoc = "" Then
            imagez = wc.DownloadData("http://finviz.com/chart.ashx?t=" & stoc & "&ty=c&ta=1&p=d&s=l")
            Dim streamwr As New MemoryStream(imagez)
            Return Image.FromStream(streamwr)
        Else
            imagez = wc.DownloadData("http://finviz.com/chart.ashx?t=lol&ty=c&ta=1&p=d&s=l")
            Dim streamwr As New MemoryStream(imagez)
            Return Image.FromStream(streamwr)
        End If
    End Function
    Private Function Copy2Clipboard() As Boolean
        Try
            Clipboard.SetDataObject(Me)
            Return True
        Catch ex As Exception
            Return False
        End Try
        Return False
    End Function
End Class
